{
        // ref https://github.com/WICG/EventListenerOptions/pull/30
        // 防止微信端下拉橡皮筋效果
        function isPassive() {
            var supportsPassiveOption = false;
            try {
                addEventListener("test", null, Object.defineProperty({}, 'passive', {
                    get: function () {
                        supportsPassiveOption = true;
                    }
                }));
            } catch(e) {}
            return supportsPassiveOption;
        }

        document.addEventListener("touchmove",function (e) {
                e.preventDefault();
            },
            isPassive()?{
                capture:false,
                passive:false
            }:false
        )
}

{
    //解决苹果端输入框弹出后无法自动弹回
    var u = navigator.userAgent,
        app = navigator.appVersion;
    var cc=null;
    var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    $(document).ready(function() {
        $("input,textarea").blur(function() {
            // if (isIOS) {
            blurAdjust();
            // }
        });
    });
    // 解决苹果不回弹页面
    function blurAdjust(e) {
        clearTimeout(cc)
        cc=setTimeout(() => {
            if (
                document.activeElement.tagName == "INPUT" ||
                document.activeElement.tagName == "TEXTAREA"
            ) {
                return;
            }
            let result = "pc";
            if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
                //判断iPhone|iPad|iPod|iOS
                result = "ios";
            } else if (/(Android)/i.test(navigator.userAgent)) {
                //判断Android
                result = "android";
            }

            if ((result = "ios")) {
                document.activeElement.scrollIntoViewIfNeeded(true);
            }
        }, 300);
    }
}

{//自用loading图片
    function preLoad(imgs,options){
        //console.log(imgs,options);
        this.imgs=(typeof imgs==='string')?[imgs]:imgs;
        this.opts=$.extend({},preLoad.DEFAULTS,options)
        this._unoredered();
      }

      preLoad.DEFAULTS={
        each:null,
        all:null
      }
      preLoad.prototype._unoredered=function(){
        var imgs=this.imgs;
        var opts=this.opts;
       
        //console.log(imgs,opts);
        var count=0,length=imgs.length;
        $.each(imgs,function(i,src){
            if(typeof src!='string') return;
            var imgObj=new Image();
            $(imgObj).on('load error',function(){
              opts.each && opts.each(count);
              if(count>=length-1){
                opts.all&&opts.all()
              }
              count++
            });
            imgObj.src=src;
        })
      }
    
    $.extend({
      preLoads:function(imgs,opts){
        console.log(imgs,opts);
        
        new preLoad(imgs,opts)
      }
    })

}